 sbtl 'lang. cd. irq, nmi, & reset'
 org $ff9b  
*
nmi equ $3fb
acc equ $45
*
lanirq equ *
 pha
 lda acc
 sta old45
 pla
 sta acc
 pla ;get status register from stack.
 pha ;(and restore it!)
 and #$10 ;is it a break or interupt
 bne lbreak ;branch if break
 lda $d000 ;get bankid
 eor #$d8 ;is the system active?
 beq sysactv ;branch if it is.
 lda #$ff
sysactv sta intbankid
 sta afbank
 lda #<aftirq
 pha ;set up return address
 lda #>aftirq
 pha
 lda #4 ;status reg w/int flag set 
 pha
lbreak lda #<romirq ;push rom entry also 
 pha
 lda #>romirq
 pha
gorom sta romin ;switch to rom (hits rts immediately).
*
lreset lda rreset+1
 pha ;since reset, acc can be destroyed.
 lda rreset
 pha
 jmp gorom
*
rreset dw $fa61  
fix45 sta intareg ;preserve the acc 
 lda old45
 sta acc
 lda ramin
 lda ramin ;switch ram in for write & read
 lda afbank
 jmp irqxit0
*
*
xxx equ *
stypfx sty newpfxptr ; fix AppleTalk PFI bug
 sty pfixptr
 rts
stapfx sta newpfxptr
 sta pfixptr
 rts
*fil equ $fffa-xxx
* ds fil,0 
*
 dw nmi
 dw lreset
 dw lanirq
